package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;

/**
 * SubscriptionService entity. @author MyEclipse Persistence Tools <b><i>powered
 * by Belev</i></b>
 */
@Entity
@Table(name = "subscription_services")
@GeneratorKey(tableName = "service_requests")
public class SubscriptionServiceVO extends ServiceRequestVO {

	private static final long serialVersionUID = -5468057745131949930L;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "contragent_id")
	private ContragentVO contragent;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id")
	private CustomerVO customer;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_subscription_appear_id", nullable = false)
	private NomSubscriptionAppearVO nomSubscriptionAppear;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "postman_id")
	private PostmanVO postman;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subscriptionService")
	private List<SubscriptionVO> subscriptions;

	/** default constructor */
	public SubscriptionServiceVO() {
		this.subscriptions = new ArrayList<SubscriptionVO>();
	}

	/** @return the contragent */
	public ContragentVO getContragent() {
		return this.contragent;
	}

	/** @return the customer */
	public CustomerVO getCustomer() {
		return this.customer;
	}

	/** @return the nomSubscriptionAppear */
	public NomSubscriptionAppearVO getNomSubscriptionAppear() {
		return this.nomSubscriptionAppear;
	}

	/** @return the postman */
	public PostmanVO getPostman() {
		return this.postman;
	}

	/** @return the subscriptions */
	public List<SubscriptionVO> getSubscriptions() {
		return this.subscriptions;
	}

	/** @param contragent */
	public void setContragent(ContragentVO contragent) {
		this.contragent = contragent;
	}

	/** @param customer */
	public void setCustomer(CustomerVO customer) {
		this.customer = customer;
	}

	/** @param nomSubscriptionAppear */
	public void setNomSubscriptionAppear(NomSubscriptionAppearVO nomSubscriptionAppear) {
		this.nomSubscriptionAppear = nomSubscriptionAppear;
	}

	/** @param postman */
	public void setPostman(PostmanVO postman) {
		this.postman = postman;
	}

	/** @param subscriptions */
	public void setSubscriptions(List<SubscriptionVO> subscriptions) {
		this.subscriptions = subscriptions;
	}
}